{* product brief view (from a category or search) *}


{if $product_info ne NULL}

<p>
<table width=100% border=0 cellspacing=1 cellpadding=2>
<tr>
<td {if $product_info.picture || $product_info.thumbnail || $product_info.allow_products_comparison}width="100"{/if} align=center valign=top>

	{if $product_info.thumbnail}
		<a class="olive" href="index.php?productID={$product_info.productID}">
			<img src="products_pictures/{$product_info.thumbnail}" 
				alt="{$product_info.name}" 
				border=0><br>
			{$smarty.const.MORE_INFO_ON_PRODUCT}
		</a><br><br>
	{else} 
		{if $product_info.picture}
			<a class="olive" href="index.php?productID={$product_info.productID}">
				<img src="products_pictures/{$product_info.picture}" 
					alt="{$product_info.name}" 
					border=0>
				{$smarty.const.MORE_INFO_ON_PRODUCT}
			</a><br><br>
		{/if}
	{/if}

		{if $product_info.allow_products_comparison}  {* removed ' && $categoryID == $product_info.categoryID' *}

				<table class="comparison_button"><form action="" method=post 
					name="MainForm3_{$product_info.productID}"><tr><td>

							<input type=checkbox value='1'
							name='ComparisonCheckBox_{$product_info.productID}'
							onchange='JavaScript:Comparison_{$product_info.productID}()'>
							{$smarty.const.STRING_SELECT_TO_COMPARISON}
				</td></tr></form></table>

				<script language='JavaScript'>

				function Comparison_{$product_info.productID}()
				{literal}
				{
				{/literal}
					_checked = 
						document.MainForm3_{$product_info.productID}.ComparisonCheckBox_{$product_info.productID}.checked;

					_index = -1;
					for(i=0; i<ComparedProducts1.length; i++)
						if ( ComparedProducts1[i] == {$product_info.productID} )
						{literal}
						{
						{/literal}
							_index = i;
							break;
						{literal}
						}
						{/literal}

					if ( _checked )
					{literal}
					{
					{/literal}
						if ( _index == -1 )
						{literal}
						{
						{/literal}
							ComparedProducts1.push( {$product_info.productID} );
							ComparedProducts2.push( {$product_info.productID} );
						{literal}
						}
						{/literal}
					{literal}
					}
					{/literal}
					else
					{literal}
					{
					{/literal}
						if ( _index != -1 )
						{literal}
						{
						{/literal}
							ComparedProducts1.splice( _index, 1 );
							ComparedProducts2.splice( _index, 1 );
						{literal}
						}
						{/literal}
					{literal}
					}
					{/literal}

				{literal}					
				}
				{/literal}

				</script>

		{/if}{* $product_info.allow_products_comparison *}

</td>

<td valign=top width="*">

	<table width=100% border="0" cellpadding=3 cellspacing=0>
		<tr>
			<td valign="top" width="30%">
				<table border=0 cellpadding=0 cellspacing=0>
					<tr>
						<td valign="top">
							<p><a class="cat" href="index.php?productID={$product_info.productID}">{$product_info.name}</a>
							
							{if $product_info.customer_votes > 0} {* rating *}
								<p><table cellspacing="0" cellpadding="0">
								<tr>
								{section name=i loop=5}
									<td>
									{if $smarty.section.i.index<$product_info.customers_rating}
										<img src="images/redstar_big.gif">
									{else}
										<img src="images/blackstar_big.gif">
									{/if}
									</td>
								{/section}
								</tr><tr>
									<td colspan=5>({$smarty.const.VOTES_FOR_ITEM_STRING}: {$product_info.customer_votes})</td>
								</tr>
								</table>
							{/if}
						</td>
					</tr>
				</table>
			</td>

			<form action="index.php?categoryID={$product_info.categoryID}&prdID={$product_info.productID}" method=post
						name="HiddenFieldsForm_{$product_info.productID}" >
			<td align=right valign=top width="70%"> {* add to cart *}				

				{if $smarty.const.CONF_OPEN_SHOPPING_CART_IN_NEW_WINDOW eq 0}

						{* shopping cart page is shown in the same window - in this cart 'add to cart' button is a form submit button *}

						{if  $product_info.Price>0 && ( $smarty.const.CONF_SHOW_ADD2CART eq 1 ) && ( $smarty.const.CONF_CHECKSTOCK==0 || $product_info.in_stock > 0 ) }
							<input name="cart_{$product_info.productID}" type="image" src="images/cart_navy.gif" alt="{$smarty.const.ADD_TO_CART_STRING}">
						{/if}

					{else}

						{* shopping cart page is shown in a popup window *}

						{if $product_info.Price>0 && ( $smarty.const.CONF_SHOW_ADD2CART eq 1 ) && 
								( $smarty.const.CONF_CHECKSTOCK==0 || $product_info.in_stock > 0 ) }
								<a href="javascript:open_window('cart.php?addproduct={$product_info.productID}{counter name='select_counter_hidden' start=0 skip=1 print=false}{counter name='select_counter_hidden_extra' start=0 skip=1 print=false}{section name=i loop=$product_info.product_extra}{if $product_info.product_extra[i].option_type eq 1}{section name=s loop=$product_info.product_extra[i].option_show_times}&option_select_hidden_{counter name=select_counter_hidden}='+document.HiddenFieldsForm_{$product_info.productID}.option_select_hidden_{counter name=select_counter_hidden_extra}_{$product_info.productID}.value+'{/section}{/if}{/section}',400,300);"><img border=0 src="images/cart_navy.gif" 
									alt="{$smarty.const.ADD_TO_CART_STRING}"></a>

							{else}
								&nbsp;
							{/if}

					{/if}
					{counter name='select_counter_hidden' start=0 skip=1 print=false}
					{section name=i loop=$product_info.product_extra}
						{if $product_info.product_extra[i].option_type eq 1}
							{section name=s loop=$product_info.product_extra[i].option_show_times}
								<input type=hidden 
									name='option_select_hidden_{counter name=select_counter_hidden}_{$product_info.productID}' 
									value='1'>
							{/section}
						{/if}
					{/section}
			</td>
			</form>
		</tr>
		<tr>
			<td colspan=2>
			
				{if $currencies_count ne 0 && $product_info.Price > 0}
					{* show list price? *}
					{if $product_info.list_price > 0 && $product_info.list_price > $product_info.Price && $product_info.Price > 0} 
						{$smarty.const.LIST_PRICE}: <font color=brown><strike>{$product_info.list_priceWithUnit}</strike></font><br>
				{/if}

				<b>{$smarty.const.CURRENT_PRICE}: 
				<font class=cat color=red>
				   {if $product_info.Price <= 0}n/a{else}{$product_info.PriceWithUnit}{/if}
				</font>
				</b>

				{* you save *}
				{if $product_info.list_price > 0 && $product_info.list_price > $product_info.Price && $product_info.Price > 0} 
					<br>
						{$smarty.const.YOU_SAVE}:
							<font color=brown>{$product_info.SavePrice} ({$product_info.SavePricePercent}%)
						</font>
					<br>
				{/if}
				 {/if}

			</td>
		</tr>

		 {if $product_info.shipping_freightUC}
		<tr>
			<td>
				{$smarty.const.ADMIN_SHIPPING_FREIGHT}:
			</td>
			<td>
				<font color=brown>{$product_info.shipping_freightUC}</font>
			</td>
		</tr>
		{/if}



		<form action="index.php?productID={$product_info.productID}" method=post 
			name="MainForm1_{$product_info.productID}">

		{counter name='select_counter' start=0 skip=1 print=false assign='select_counter_var'}
		{section name=i loop=$product_info.product_extra}
			{if $product_info.product_extra[i].option_type eq 0 }
				<!--<tr bgcolor="{if $smarty.section.i.index % 2 == 0}#{$smarty.const.CONF_LIGHT_COLOR}{else}white{/if}">
					<td>
						{$product_info.product_extra[i].name}:
					</td>
					<td>
						<b>{$product_info.product_extra[i].option_value}</b>
					</td>
				</tr>-->
			{else}
				{section name=k loop=$product_info.product_extra[i].option_show_times}
					<tr>					
						<td>
							{$product_info.product_extra[i].name}{if $product_info.product_extra[i].option_show_times > 1} ({$smarty.section.k.index+1}):{else}:{/if}
						</td>
						<td>
							{counter name=select_counter}
							{if $smarty.section.k.index == 0}
								<select name='option_select_{$select_counter_var}_{$product_info.productID}'
									onchange='JavaScript:GetCurrentCurrency_{$product_info.productID}();'>
									{section name=j loop=$product_info.product_extra[i].values_to_select}
										{if $product_info.product_extra[i].values_to_select[j].variantID eq $product_info.product_extra[i].variantID}
											<option value='{$product_info.product_extra[i].values_to_select[j].price_surplus}:{$product_info.product_extra[i].values_to_select[j].variantID}' selected>
										{else}
											<option value='{$product_info.product_extra[i].values_to_select[j].price_surplus}:{$product_info.product_extra[i].values_to_select[j].variantID}'>
										{/if}
											{$product_info.product_extra[i].values_to_select[j].option_value}
										</option>
									{/section}
								</select>
							{else}
								<select name='option_select_{$select_counter_var}_{$product_info.productID}'
									onchange='JavaScript:GetCurrentCurrency_{$product_info.productID}();'>
									<option value='0:-1'>{$smarty.const.NOT_DEFINED}</option>
									{section name=j loop=$product_info.product_extra[i].values_to_select}
										<option value='{$product_info.product_extra[i].values_to_select[j].price_surplus}:{$product_info.product_extra[i].values_to_select[j].variantID}'>
											{$product_info.product_extra[i].values_to_select[j].option_value}
										</option>
									{/section}
								</select>
							{/if}
						</td>
					</tr>
				{/section}
			{/if}
		{/section}

		</form>

		{if $select_counter_var != 0}
		<tr>
			<form action="index.php?productID={$product_info.productID}" method=post 
					name="MainForm2_{$product_info.productID}"><td colspan=2>
				
				
					{if $product_info.Price > 0}
					<b>{$smarty.const.CURRENT_PRICE_OPTION}:<br></b>
					{/if}

					<input type=hidden value="{php}echo(getPriceUnit());{/php}" 
						name="priceUnit_{$product_info.productID}">
					{if $product_info.Price <= 0}
						<input type=hidden value="" 
							id="optionPrice_{$product_info.productID}">
				
					{else}
						<input type=text value="" 
							class=totalPrice 
							readonly 
							id="optionPrice_{$product_info.productID}">
					{/if}
				
			</td></form>
		</tr>
		{/if}

		{if $product_info.brief_description}
		<tr>
			<td colspan=2 bgcolor="#{$smarty.const.CONF_LIGHT_COLOR}">
				{$product_info.brief_description}
			</td>
		</tr>
		{/if}


	</table>



	{if $select_counter_var != 0}
	<script langauge='JavaScript'>

		function GetCurrentCurrency_{$product_info.productID}()
		{literal}
		{
		{/literal}
			_selectionCount={$select_counter_var};
			_sum = {$product_info.PriceWithOutUnit};


			{counter name='select_counter2' start=1 skip=1 print=false 
						assign='select_counter_var2'}
			{section name=i loop=$product_info.product_extra}
				{section name=k loop=$product_info.product_extra[i].option_show_times}

					_value =
						document.MainForm1_{$product_info.productID}.option_select_{$select_counter_var2}_{$product_info.productID}.value;
					price_surplus = ( _value.split(":") )[0];
					_sum += new Number( price_surplus );
					variantID = ( _value.split(":") )[1];
					document.HiddenFieldsForm_{$product_info.productID}.option_select_hidden_{$select_counter_var2}_{$product_info.productID}.value = 
						variantID;

					{counter name=select_counter2}

				{/section}
			{/section}

			_sumStr = new String(_sum);
			_commaIndex = _sumStr.indexOf(".");
			if ( _commaIndex == -1 )
				_sumStr = _sum;
			else
				_sumStr = _sumStr.substr(0, _commaIndex + 3);
			{php}
				echo("locationPriceUnit=".getLocationPriceUnit().";\n");
			{/php}

			_sumStr = _formatPrice(_sumStr);

			if ( locationPriceUnit )
				document.MainForm2_{$product_info.productID}.optionPrice_{$product_info.productID}.value = 
					_sumStr + document.MainForm2_{$product_info.productID}.priceUnit_{$product_info.productID}.value;
			else
				document.MainForm2_{$product_info.productID}.optionPrice_{$product_info.productID}.value = 
					document.MainForm2_{$product_info.productID}.priceUnit_{$product_info.productID}.value + _sumStr;
		{literal}
		}
		{/literal}

		GetCurrentCurrency_{$product_info.productID}();

	</script>
	{/if}

</td>
</tr>
</table>
{/if}